package com.jeeplus.test.jlnu.student.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeeplus.test.jlnu.student.domain.entity.BkStudentInfo;
import com.jeeplus.test.jlnu.student.domain.entity.BkStudentResume;
import com.jeeplus.test.jlnu.student.domain.vo.BkStudentResumeReqVo;
import com.jeeplus.test.jlnu.student.mapper.BkStudentInfoMapper;
import com.jeeplus.test.jlnu.student.mapper.BkStudentResumeMapper;
import com.jeeplus.test.jlnu.student.service.BkStudentInfoService;
import com.jeeplus.test.jlnu.student.service.BkStudentResumeService;
import com.jeeplus.test.tools.resp.Convert2Bean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BkStudentResumeServiceImpl extends ServiceImpl<BkStudentResumeMapper, BkStudentResume> implements BkStudentResumeService {
    @Autowired
    private BkStudentResumeMapper bkStudentResumeMapper;

    @Override
    public BkStudentResume getBkStudentResume(String studentId) {
        LambdaQueryChainWrapper<BkStudentResume> wrapper = new LambdaQueryChainWrapper<>(bkStudentResumeMapper);
        wrapper.eq(BkStudentResume::getStudentId, studentId);
        return wrapper.one();
    }

    @Override
    public Boolean bkStudentResumeUpdate(BkStudentResume bkStudentResume) {
        LambdaUpdateChainWrapper<BkStudentResume> wrapper = new LambdaUpdateChainWrapper<>(bkStudentResumeMapper);
        if (ObjectUtil.isNotEmpty(bkStudentResume.getAutobiography())){
            wrapper.set(BkStudentResume::getAutobiography,bkStudentResume.getAutobiography());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume1StartDate())){
            wrapper.set(BkStudentResume::getResume1StartDate,bkStudentResume.getResume1StartDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume1EndDate())){
            wrapper.set(BkStudentResume::getResume1EndDate,bkStudentResume.getResume1EndDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume1Location())){
            wrapper.set(BkStudentResume::getResume1Location,bkStudentResume.getResume1Location());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume1Institution())){
            wrapper.set(BkStudentResume::getResume1Institution,bkStudentResume.getResume1Institution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume1Referencer())){
            wrapper.set(BkStudentResume::getResume1Referencer,bkStudentResume.getResume1Referencer());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume1ReferencerInstitution())){
            wrapper.set(BkStudentResume::getResume1ReferencerInstitution,bkStudentResume.getResume1ReferencerInstitution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume2StartDate())){
            wrapper.set(BkStudentResume::getResume2StartDate,bkStudentResume.getResume2StartDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume2EndDate())){
            wrapper.set(BkStudentResume::getResume2EndDate,bkStudentResume.getResume2EndDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume2Location())){
            wrapper.set(BkStudentResume::getResume2Location,bkStudentResume.getResume2Location());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume2Institution())){
            wrapper.set(BkStudentResume::getResume2Institution,bkStudentResume.getResume2Institution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume2Referencer())){
            wrapper.set(BkStudentResume::getResume2Referencer,bkStudentResume.getResume2Referencer());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume2ReferencerInstitution())){
            wrapper.set(BkStudentResume::getResume2ReferencerInstitution,bkStudentResume.getResume2ReferencerInstitution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume3StartDate())){
            wrapper.set(BkStudentResume::getResume3StartDate,bkStudentResume.getResume3StartDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume3EndDate())){
            wrapper.set(BkStudentResume::getResume3EndDate,bkStudentResume.getResume3EndDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume3Location())){
            wrapper.set(BkStudentResume::getResume3Location,bkStudentResume.getResume3Location());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume3Institution())){
            wrapper.set(BkStudentResume::getResume3Institution,bkStudentResume.getResume3Institution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume3Referencer())){
            wrapper.set(BkStudentResume::getResume3Referencer,bkStudentResume.getResume3Referencer());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume3ReferencerInstitution())){
            wrapper.set(BkStudentResume::getResume3ReferencerInstitution,bkStudentResume.getResume3ReferencerInstitution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume4StartDate())){
            wrapper.set(BkStudentResume::getResume4StartDate,bkStudentResume.getResume4StartDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume4EndDate())){
            wrapper.set(BkStudentResume::getResume4EndDate,bkStudentResume.getResume4EndDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume4Location())){
            wrapper.set(BkStudentResume::getResume4Location,bkStudentResume.getResume4Location());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume4Institution())){
            wrapper.set(BkStudentResume::getResume4Institution,bkStudentResume.getResume4Institution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume4Referencer())){
            wrapper.set(BkStudentResume::getResume4Referencer,bkStudentResume.getResume4Referencer());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume4ReferencerInstitution())){
            wrapper.set(BkStudentResume::getResume4ReferencerInstitution,bkStudentResume.getResume4ReferencerInstitution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume5StartDate())){
            wrapper.set(BkStudentResume::getResume5StartDate,bkStudentResume.getResume5StartDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume5EndDate())){
            wrapper.set(BkStudentResume::getResume5EndDate,bkStudentResume.getResume5EndDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume5Location())){
            wrapper.set(BkStudentResume::getResume5Location,bkStudentResume.getResume5Location());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume5Institution())){
            wrapper.set(BkStudentResume::getResume5Institution,bkStudentResume.getResume5Institution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume5Referencer())){
            wrapper.set(BkStudentResume::getResume5Referencer,bkStudentResume.getResume5Referencer());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getResume5ReferencerInstitution())){
            wrapper.set(BkStudentResume::getResume5ReferencerInstitution,bkStudentResume.getResume5ReferencerInstitution());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getYouthLeagueJoinDate())){
            wrapper.set(BkStudentResume::getYouthLeagueJoinDate,bkStudentResume.getYouthLeagueJoinDate());
        }
        if (ObjectUtil.isNotEmpty(bkStudentResume.getPartyJoinDate())){
            wrapper.set(BkStudentResume::getPartyJoinDate,bkStudentResume.getPartyJoinDate());
        }
        //根据id修改
        wrapper.eq(BkStudentResume::getId, bkStudentResume.getId());
        return wrapper.update();
    }
}
